#define BOOST_TEST_MODULE testElementWorkflow

#include <boost/test/unit_test.hpp>

#include "common/elements/element_maker.h"
#include "common/elements/workflow.h"

BOOST_AUTO_TEST_CASE(testWorkflowJson)
{
    auto first = std::make_shared<Elements::Workflow>();
    first->setId(1);
    first->setCaption("a");
    first->setDescription("b");

    const auto json = first->toJsonString();
    const Elements::ElementPtr second(Elements::fromJsonString(json));
    BOOST_CHECK(first->isSame(second.get()));

    const auto third = std::static_pointer_cast<Elements::Workflow>(second);
    BOOST_CHECK(1 == third->id());
    BOOST_CHECK("a" == third->caption());
    BOOST_CHECK("b" == third->description());
}
